//
//  DDErrorCodeMapping.m
//  Dingdong
//
//  Created by 程强 on 16/11/23.
//  Copyright © 2016年 程强. All rights reserved.
//

#import "DDErrorCodeMapping.h"

static DDErrorCodeMapping *mapping = nil;

@implementation DDErrorCodeMapping
+ (instancetype)shareInstance
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        mapping = [[DDErrorCodeMapping alloc]init];
    });
    return mapping;
}

+ (DingDongErrorCode)errorCodeMappingWithServerCode:(NSString *)code
{
//    InterfaceResult(code);
    if ([code isEqualToString:@"00000"]) {
        return DingDongErrorCodeSuccess;
    }
    if ([code isEqualToString:@"30001"]) {
        return DingDongErrorCodeEmailUsed;
    }
    if ([code isEqualToString:@"00001"]) {
        return DingDongErrorCodeSystemError;
    }
    if ([code isEqualToString:@"20001"]) {
        return DingDongErrorCodeTokenNil;
    }
    return DingDongErrorCodeFailed;
}

@end
